import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'LayoutView',
    redirect: '/home', // 默认跳转到首页
    component: () => import('@/views/Layout/LayoutView.vue'),
    children: [
      {
        path: '/my',
        name: 'MyView',
        component: () => import('@/views/my/MyView.vue')
      },
      {
        path: '/home',
        name: 'HomeView',
        component: () => import('@/views/home/HomeView.vue')
      }, {
        path: '/cart',
        name: 'CartView',
        component: () => import('@/views/cart/CartView.vue')
      }, {
        path: "/order",
        name: "OrderView",
        component: () => import('@/views/order/OrderView.vue')
      }
    ]
  },
  {
    path: '/shop/:id',
    name: 'ShopDetail',
    component: () => import('@/views/shop/ShopView.vue')
  },
  {
    path: '/orderConfirmation',
    name: 'OrderConfirmation',
    component: () => import('@/views/orderConfirmation/OrderConfirmationView.vue')
  },
  {
    path: '/createAddress',
    name: 'CreateAddress',
    component: () => import('@/views/my/CreateAddressView.vue')
  },
  {
    path: "/address",
    name: "AddressView",
    component: () => import('@/views/my/AddressView.vue')
  },
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})

export default router
